<?php


namespace App\Http\Controllers\android\api;


use App\Http\Controllers\android\service\AppService;
use App\Http\Controllers\android\validate\App;
use App\Http\Controllers\utils\ToolUtil;
use Illuminate\Http\Request;

class AppApi
{
    
    public function getAppAndWhite(Request $request){
        $param = $request->all();
        $data = App::getAppAndWhite($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getAppAndWhite($param);
    }

    public function getBrand(Request $request){
        $param = $request->all();
        $data = App::getBrand($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getBrand($param);
    }

    public function getTopic(Request $request){
        $param = $request->all();
        $data = App::getTopic($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getTopic($param);
    }

    public function getClassify(Request $request){
        $param = $request->all();
        $data = App::getClassify($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getClassify($param);
    }

    public function getForceDownload(Request $request){
        $param = $request->all();
        $data = App::getForceDownload($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::getForceDownload($param);
    }

    public function addAppInstall(Request $request){
        $param = $request->all();
        $data = App::addAppInstall($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::addAppInstall($param);
    }

    public function updateAppInstall(Request $request){
        $param = $request->all();
        $data = App::updateAppInstall($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::updateAppInstall($param);
    }

    public function addAppLog(Request $request){
        $param = $request->all();
        $data = App::addAppLog($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::addAppLog($param);
    }

    public function downloadApp(Request $request){
        $param = $request->all();
        $data = App::downloadApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::downloadApp($param);
    }

    public function queryAllApp(Request $request){
        $param = $request->all();
        $data = App::queryAllApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryAllApp($param);
    }

    public function queryPackageApp(Request $request){
        $param = $request->all();
        $data = App::queryPackageApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::queryPackageApp($param);
    }

    public function newestAppUpdate(Request $request){
        $param = $request->all();
        $data = App::newestAppUpdate($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::newestAppUpdate($param);
    }

    public function runNewApp(Request $request){
        $param = $request->all();
        $data = App::runNewApp($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return AppService::runNewApp($param);
    }

    public function queryAppUpdate(){
        return AppService::queryAppUpdate();
    }
}